<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org" >
<head>
    <th:block th:include="include :: header('修改自检记录')" />
    <th:block th:include="include :: datetimepicker-css" />
    <th:block th:include="include :: bootstrap-fileinput-css"/>
</head>
<body class="white-bg">
    <div class="wrapper wrapper-content animated fadeInRight ibox-content">
        <form class="form-horizontal m" id="form-send-edit" th:object="${bizSendGas}">
            <input name="sn" th:field="*{sn}" type="hidden">
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">店铺名称：</label>
                    <div class="col-sm-8">
                        <input name="shopName" th:field="*{shopName}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">店铺位置：</label>
                    <div class="col-sm-8">
                        <input name="shopSite" th:field="*{shopSite}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">店铺照片：</label>
                    <div class="col-sm-8">
                        <input type="hidden" name="shopPic" th:field="*{shopPic}">
                       <div class="file-loading">
                            <input class="form-control file-upload" id="shopPic" name="file" type="file">
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">商户电话：</label>
                    <div class="col-sm-8">
                        <input name="shopPhome" th:field="*{shopPhome}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">证件号码：</label>
                    <div class="col-sm-8">
                        <input name="shopCard" th:field="*{shopCard}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">管气阀照片：</label>
                    <div class="col-sm-8">
                        <input type="hidden" name="gatePic" th:field="*{gatePic}">
                       <div class="file-loading">
                            <input class="form-control file-upload" id="gatePic" name="file" type="file">
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">报警器照片：</label>
                    <div class="col-sm-8">
                        <input type="hidden" name="alarmPic" th:field="*{alarmPic}">
                       <div class="file-loading">
                            <input class="form-control file-upload" id="alarmPic" name="file" type="file">
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">气瓶照片：</label>
                    <div class="col-sm-8">
                        <input type="hidden" name="gasPic" th:field="*{gasPic}">
                       <div class="file-loading">
                            <input class="form-control file-upload" id="gasPic" name="file" type="file">
                        </div>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">备注：</label>
                    <div class="col-sm-8">
                        <textarea name="remark" class="form-control">[[*{remark}]]</textarea>
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">自检人：</label>
                    <div class="col-sm-8">
                        <input name="sendPerson" th:field="*{sendPerson}" class="form-control" type="text">
                    </div>
                </div>
            </div>
            <div class="col-xs-12">
                <div class="form-group">
                    <label class="col-sm-3 control-label">自检时间：</label>
                    <div class="col-sm-8">
                        <div class="input-group date">
                            <input name="inputTime" th:value="${#dates.format(bizSendGas.inputTime, 'yyyy-MM-dd')}" class="form-control" placeholder="yyyy-MM-dd" type="text">
                            <span class="input-group-addon"><i class="fa fa-calendar"></i></span>
                        </div>
                    </div>
                </div>
            </div>
        </form>
    </div>
    <th:block th:include="include :: footer" />
    <th:block th:include="include :: datetimepicker-js" />
    <th:block th:include="include :: bootstrap-fileinput-js"/>
    <script th:inline="javascript">
        var prefix = ctx + "system/send";
        $("#form-send-edit").validate({
            focusCleanup: true
        });

        function submitHandler() {
            if ($.validate.form()) {
                $.operate.save(prefix + "/edit", $('#form-send-edit').serialize());
            }
        }

        $("input[name='inputTime']").datetimepicker({
            format: "yyyy-mm-dd",
            minView: "month",
            autoclose: true
        });

        $(".file-upload").each(function (i) {
            var val = $("input[name='" + this.id + "']").val()
            $(this).fileinput({
                'uploadUrl': ctx + 'common/upload',
                initialPreviewAsData: true,
                initialPreview: [val],
                maxFileCount: 1,
                autoReplace: true
            }).on('fileuploaded', function (event, data, previewId, index) {
                $("input[name='" + event.currentTarget.id + "']").val(data.response.url)
            }).on('fileremoved', function (event, id, index) {
                $("input[name='" + event.currentTarget.id + "']").val('')
            })
            $(this).fileinput('_initFileActions');
        });
    </script>
</body>
</html>